<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>promise</title>
    <script>
       let user = {
           id:10086,
           name:"ldh",
           age:50
       }

       //获取当前对象所有的属性key存入一个数组中
       let userKeys = Object.keys(user);
       //获取当前对象所有的属性value存入一个数组中
       let usersValues = Object.values(user);

       console.log(userKeys);

       console.log(usersValues);


       for(let i=0;i<userKeys.length;i++){
           //取得当前对象的每一个key
           let key = userKeys[i];

           //在js中如果要从一个对象中根据key取值，如果key是变量，一定要把这个变量key'写道中括号中
           let value = user[key];

           console.log(key)
           console.log(value)
       }




    </script>
</head>
<body>

</body>
</html>